package com.my.attendance.service;

import com.my.attendance.dao.ChaxunDAO;
import com.my.attendance.entity.Employee;
import com.my.attendance.entity.Leave;

import java.util.List;

public class ChaxunList {
    private ChaxunDAO chaxundao= new ChaxunDAO();

    public List<Leave> getchaxunList() throws Exception {
        List<Leave> list = chaxundao.getchaxundao();
        for (Leave leave : list) {
            Integer employee_number = leave.getEmployee_number();
            Employee employee = chaxundao.getUserName(employee_number);
            leave.setEmployee(employee);
        }
        return list;
    }

    public List<Leave> getYESpizhun() throws Exception {
        List<Leave> list = chaxundao.getYSEpizhun();
        for (Leave leave : list) {
            Integer employee_number = leave.getEmployee_number();
            Employee employee = chaxundao.getUserName(employee_number);
            leave.setEmployee(employee);
        }
        return list;
    }


    public List<Leave> getnopizhun() throws Exception {
        List<Leave> list = chaxundao.getNOpizhun();
        for (Leave leave : list) {
            Integer employee_number = leave.getEmployee_number();
            Employee userName = chaxundao.getUserName(employee_number);
            leave.setEmployee(userName);
        }
        return list;
    }


    public Leave getchakan(String id) throws Exception {

        Leave leave = chaxundao.getChakan(id);
        Integer employee_number = leave.getEmployee_number();
        Employee userName = chaxundao.getUserName(employee_number);
        leave.setEmployee(userName);
        return leave;
    }

    public int getpizhun(String id) throws Exception {
        int i = chaxundao.getPIzhun(id);
        System.out.println("chaxunlist收到的i："+i);
        return i;
    }
}
